package com.aizhixin.lab.project.template.service;

import com.aizhixin.lab.common.core.DataValidity;
import com.aizhixin.lab.project.template.entity.ProjectVideo;
import com.aizhixin.lab.project.template.repository.ProjectVideoRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Slf4j
@Service
@Transactional
public class ProjectVideoService {
    @Autowired
    private ProjectVideoRepository videoRepository;
    public ProjectVideo save(ProjectVideo projectVideo){
        return videoRepository.save(projectVideo);
    }
    public List<ProjectVideo> save(List<ProjectVideo> projectVideo){
        return videoRepository.save(projectVideo);
    }
    public List<ProjectVideo> findVideoList(String id){
        return videoRepository.findByProjectIdAndDeleteFlag(id, DataValidity.VALID.getState());
    }
    public Integer deleteByProjectId(String projectId){
        return videoRepository.deleteByProjectId(projectId);
    }
}
